package com.pgeneral.user.management.service.impl;

import com.pgeneral.user.management.exception.MyException;
import com.pgeneral.user.management.util.UUIDGenerator;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.pgeneral.user.management.entity.DepartmentInfo;
import com.pgeneral.user.management.dao.DepartmentInfoMapper;
import com.pgeneral.user.management.service.DepartmentInfoService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 龙
 * @create 2020/6/30 11:41
 */
@Service
public class DepartmentInfoServiceImpl implements DepartmentInfoService {

    @Resource
    private DepartmentInfoMapper departmentinfoMapper;


    @Override
    @Transactional(rollbackFor = Exception.class)
    public int insert(List<DepartmentInfo> departmentInfos) {
        if (departmentInfos == null || departmentInfos.size() == 0) {
            throw new MyException("1001", "传递的参数为空");
        }
        return departmentinfoMapper.insert(departmentInfos);
    }

    @Override
    public List<DepartmentInfo> getDepartmentinfoTable(DepartmentInfo departmentinfo) {
        return departmentinfoMapper.getDepartmentinfoTable(departmentinfo);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateDepartmentinfoTable(List<DepartmentInfo> departmentInfos) {
        return departmentinfoMapper.updateDepartmentinfoTable(departmentInfos);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateIsDeletefromDepartmentinfoTable(List<String> ids) {
        return departmentinfoMapper.updateIsDeletefromDepartmentinfoTable(ids);
    }
}

